/**
  ******************************************************************************
  * @file           : auto_decision_make_task.h
  * @author         : Tessia
  * @brief          : None
  * @attention      : None
  * @date           : 2024/3/14
  ******************************************************************************
  */



#ifndef SENTRY_RIGHT_GIMBAL_AUTO_DECISION_MAKE_TASK_H
#define SENTRY_RIGHT_GIMBAL_AUTO_DECISION_MAKE_TASK_H

#include "state_machine_drv.h"
#include "communicate_task.h"

/**
 * 下方服务器模式与调试模式应不能同时存在
 */
#define SERVER_EXIST 1              //服务器存在
#define ENEMY_OUTPOST_EXIST 1       //敌方前哨站存在
#define OUR_OUTPOST_EXIST 1         //我方前哨站存在

/**
 * 下方调试模式应该只有一个存在
 */
#define MATCH_MODE 1                //正式比赛时必须开启
#define RADAR_DEBUG 0               //雷达调试
#define PATROL_DEBUG 0              //巡逻调试
#define CONSTRAINED_DEFENCE_DEBUG 0 //我方前哨站摧毁后调试
#define SUPPLY_DEFENCE_DEBUG 0      //补给状态调试
#define FREE_DEFENCE_DEBUG 0        //已死亡一次后状态调试
#define GO_ATTACK_OUTPOST_DEBUG 0   //打击前哨站调试 1旋转 2静止
#define FORCE_NOT_SPIN 0            //强制不旋转

/**
 * 杂七杂八的宏定义
 */
#define ONLY_HERO 1                 //雷达锁定只响应英雄


const float ATTACK_DISTANCE = 3.f;

const uint16_t DIRECT_ATTACK_OUTPOST_TIME = 418;
const uint16_t NORMAL_ATTACK_OUTPOST_TIME = 240;
const uint16_t LEFT_ATTACK_OUTPOST_PATROL_TIME = 40;

const uint16_t REMOTE_EXCHANGE_AMMO_GOLD_COIN = 700;
const uint16_t EXCHANGE_AMMO_GOLD_COIN = 650;

const uint16_t NORMAL_ATTACK_ENGINEER_TIME = 415;
const uint16_t NO_ATTACK_ENGINEER_TIME = 10;

const uint16_t OUTPOST_AMMUNITION_CAPACITY = 200;

const uint16_t SENTRY_GO_BACK_TIME = 60;


struct point2f{
    float x;
    float y;
};

const uint16_t LOCATION_NUM = 21;

enum location{ //特定位置
    farthest_point = 0,             //最远点
    center_point = 1,               //中心点
    bottom_right_corner = 2,        //右下角
    top_right_corner = 3,           //右上角
    bottom_left_corner = 4,         //左下角
    top_left_corner = 5,            //左上角
    initial_point = 6,              //出生点
    radical_point = 7,              //激进点
    conservative_point = 8,         //保守点
    healing_point = 9,              //回血点

    /***************  以下地点RMUC用  *****************/
    enemy_gathering_point = 10,     //敌方汇进点
    enemy_base_entrance = 11,       //敌方基地口
    enemy_R1_entrance = 12,         //敌方R1坡口
    enemy_outpost_impact_point = 13,//敌方前哨站打击点

    our_base_patrol_zone = 14,      //我方基地巡逻区
    our_R2_patrol_zone = 15,        //我方R2巡逻区
    our_R3_patrol_zone = 16,        //我方R3巡逻区
    our_R4_patrol_zone = 17,        //我方R4巡逻区
    our_outpost_defence_zone = 18,  //我方前哨站保卫区
    our_bridge_tunnel_entrance = 19,//我方桥洞入口
    our_R1_entrance = 20,           //我方R1坡口
};


enum ascii_num{
    cmd_A = 65,
    cmd_B,
    cmd_C,
    cmd_D,
    cmd_E,
    cmd_F,
    cmd_G,
    cmd_H,
    cmd_I,
    cmd_J,
    cmd_K,
    cmd_L,
    cmd_M,
    cmd_N,
    cmd_O,
    cmd_P,
    cmd_Q,
    cmd_R,
    cmd_S,
    cmd_T,
    cmd_U,
    cmd_V,
    cmd_W,
    cmd_X,
    cmd_Y,
    cmd_Z,
};


float distance_between_double_coo(float x_1, float y_1, float x_2, float y_2);
float distance_to_sentry(float x, float y);

#ifdef __cplusplus
extern "C" {
#endif
//C
void auto_decision_make_task(void *argument);
void judge_event_happened_task(void *argument);
#ifdef __cplusplus
}
#endif
//C++

#endif //SENTRY_RIGHT_GIMBAL_AUTO_DECISION_MAKE_TASK_H
